import time
from threading import Thread


def print_info(name, char, n=None, interv=0.2):
    while True:
        if n is not None:
            if n <= 0:
                break
            n -= 1
        print(char, end='', flush=True)
        time.sleep(interv)
    print(f'{name} over.')


t1 = Thread(target=print_info, args=('t1', '1', 25, ))
t1.start()

t2 = Thread(target=print_info, args=('t1', '2', 20, ))
t2.start()

# t3 = Thread(target=print_info, args=('t3', '3', ), daemon=False)
t3 = Thread(target=print_info, args=('t3', '3', ), daemon=True)  # T3 is daemon means that we do not wait it on end.
t3.start()

time.sleep(0.5)
print('t1.is_alive', t1.is_alive())
print('t2.is_alive', t2.is_alive())

print('Joining t2 ...')
t2.join()
print('t1.is_alive', t1.is_alive())
print('t2.is_alive', t2.is_alive())

print('Main over.')
